@import (reference) 'config';

input[type="checkbox"] {
  position: absolute;
  margin: 0;
  left: 2px;
  top: 2px;
  z-index: 0;

  &::after {
    content: '';
    display: block;
    position: absolute;
    left: 0;
    top: 0;
    width: 18px;
    height: 18px;
    background-color: @color-white;
    border: 1px solid @color-basic-200;
    border-radius: @border-radius;
    z-index: 1;
    box-sizing: border-box;
    transform: translate(-2px, -2px);
  }

  &:checked::after {
    background-size: 9px 7px;
  }

  &.submit:checked::after {
    background: @color-submit-400 url(/img/icons/checkbox-icon.svg) no-repeat center center;
    border-color: @color-submit-400;
  }
}

w-checkbox-submit {
  margin-right: 12px;
  min-width: 19px;
  input {
    &[disabled="disabled"]::after {
      background: url(/img/icons/checkbox-icon.svg) center no-repeat @color-submit-100;
      border: 1px solid @color-submit-200;
    }
  }
}

w-checkbox-submit, w-checkbox-success {
  display: inline-block;
  position: relative;
  width: 19px;
  height: 19px;
  overflow: hidden;
  cursor: pointer;

  & + label {
    cursor: pointer;
  }
}

w-checkbox-switcher {
  display: inline-block;
  position: relative;
  width: 53px;
  height: 30px;
  overflow: hidden;
}

.unit-checkbox {
  display: flex;
  min-height: auto;
  margin-bottom: 20px;

  w-checkbox-submit {
    flex-grow: 0;
    align-self: flex-start;
    display: block;
  }

  label {
    flex-grow: 1;
  }
}

.input-toggle {
  display: flex;
  align-items: center;

  w-checkbox-submit {
    display: none;
  }

  w-checkbox-submit + label {
    width: 40px;
    height: 20px;
    border: 1px solid @color-basic-200;
    background: @color-basic-200;
    border-radius: 10px;
    display: block;
    position: relative;
    transition: .3s;

    &:hover {
      border: 1px solid @input-toggle-bg-hover;
      background: @input-toggle-bg-hover;
    }

    &::before {
      transition: .3s;
      background: @color-white;
      width: 18px;
      height: 18px;
      content: '';
      position: absolute;
      left: 0;
      top: 0;
      border-radius: 50%;
      display: block;
    }
  }

  &.active {
    w-checkbox-submit + label {
      border: 1px solid @color-submit-400;
      background: @color-submit-400;

      &::before {
        transform: translateX(20px);
      }
    }
  }
}
